<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>男性健康自测系统 - 毅嘉互联科技</title>
    <meta name="description" content="专业的男性健康自测系统，提供科学的健康评估和建议">
    
    <!-- 国内CDN资源 -->
    <link href="https://cdn.bootcdn.net/ajax/libs/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
    <link href="https://cdn.bootcdn.net/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    
    <style>
        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            min-height: 100vh;
        }
        
        .header-fixed {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            z-index: 1000;
            background: rgba(255, 255, 255, 0.95);
            backdrop-filter: blur(10px);
            border-bottom: 1px solid rgba(0, 0, 0, 0.1);
        }
        
        .main-content {
            margin-top: 120px;
            padding-bottom: 2rem;
        }
        
        .question-card {
            background: white;
            border-radius: 15px;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
            transition: transform 0.3s ease, box-shadow 0.3s ease;
        }
        
        .question-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
        }
        
        .progress-bar {
            background: linear-gradient(90deg, #667eea, #764ba2);
            height: 6px;
            border-radius: 3px;
            transition: width 0.3s ease;
        }
        
        .option-item {
            transition: all 0.3s ease;
            cursor: pointer;
        }
        
        .option-item:hover {
            background-color: #f3f4f6;
            transform: translateX(5px);
        }
        
        .option-item.selected {
            background-color: #667eea;
            color: white;
            border-color: #667eea;
        }
        
        .fade-in {
            animation: fadeIn 0.5s ease-in;
        }
        
        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(20px); }
            to { opacity: 1; transform: translateY(0); }
        }
        
        .result-card {
            background: white;
            border-radius: 20px;
            box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
            max-width: 600px;
            margin: 0 auto;
        }
        
        .risk-low { color: #10b981; }
        .risk-medium { color: #f59e0b; }
        .risk-high { color: #ef4444; }
        
        .form-input:focus {
            outline: none;
            border-color: #667eea;
            box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
        }
        
        @media (max-width: 640px) {
            .main-content {
                margin-top: 140px;
            }
        }
    </style>
</head>
<body>
    <!-- 固定头部版权信息 -->
    <header class="header-fixed">
        <div class="max-w-7xl mx-auto px-4 py-3">
            <div class="text-center">
                <div class="text-sm font-bold text-gray-800 mb-1">
                    ©️毅嘉互联科技 - 版权所有，侵权必究
                </div>
                <div class="text-xs text-gray-600">
                    制作、校准：谢俊杰
                </div>
                <div class="text-xs text-gray-500">
                    地址：四川省成都市新津区
                </div>
            </div>
        </div>
    </header>

    <!-- 主内容区域 -->
    <main class="main-content">
        <div class="max-w-4xl mx-auto px-4">
            <!-- 欢迎页面 -->
            <div id="welcome-page" class="fade-in">
                <div class="text-center mb-8">
                    <h1 class="text-4xl font-bold text-white mb-4">
                        <i class="fas fa-heartbeat mr-2"></i>
                        男性健康自测系统
                    </h1>
                    <p class="text-xl text-white opacity-90">
                        科学评估，专业建议，守护您的健康
                    </p>
                </div>

                <div class="question-card p-8 mb-6">
                    <h2 class="text-2xl font-bold text-gray-800 mb-6 text-center">个人信息</h2>
                    
                    <form id="user-form" class="space-y-6">
                        <div>
                            <label class="block text-sm font-medium text-gray-700 mb-2">
                                姓名 <span class="text-red-500">*</span>
                            </label>
                            <input type="text" 
                                   id="user-name" 
                                   class="form-input w-full px-4 py-3 border border-gray-300 rounded-lg"
                                   placeholder="请输入您的姓名（2-3个汉字）"
                                   maxlength="3"
                                   required>
                            <div id="name-error" class="text-red-500 text-sm mt-1 hidden"></div>
                        </div>

                        <div>
                            <label class="block text-sm font-medium text-gray-700 mb-2">
                                性别 <span class="text-red-500">*</span>
                            </label>
                            <select id="user-gender" 
                                    class="form-input w-full px-4 py-3 border border-gray-300 rounded-lg" 
                                    required>
                                <option value="">请选择性别</option>
                                <option value="男">男</option>
                            </select>
                        </div>

                        <div>
                            <label class="block text-sm font-medium text-gray-700 mb-2">
                                年龄 <span class="text-red-500">*</span>
                            </label>
                            <input type="number" 
                                   id="user-age" 
                                   class="form-input w-full px-4 py-3 border border-gray-300 rounded-lg"
                                   placeholder="请输入年龄（18-35岁）"
                                   min="18" 
                                   max="35"
                                   required>
                            <div id="age-error" class="text-red-500 text-sm mt-1 hidden"></div>
                        </div>

                        <button type="submit" 
                                class="w-full bg-gradient-to-r from-purple-600 to-blue-600 text-white py-3 px-6 rounded-lg font-semibold hover:from-purple-700 hover:to-blue-700 transition duration-300">
                            开始测试
                        </button>
                    </form>
                </div>
            </div>

            <!-- 测试页面 -->
            <div id="test-page" class="hidden">
                <div class="mb-6">
                    <div class="flex justify-between items-center mb-4">
                        <h2 class="text-2xl font-bold text-white">
                            <span id="current-question">1</span> / 35
                        </h2>
                        <div class="text-white">
                            <span id="user-info-display"></span>
                        </div>
                    </div>
                    <div class="bg-white bg-opacity-20 rounded-full h-2">
                        <div class="progress-bar" id="progress-bar" style="width: 2.86%"></div>
                    </div>
                </div>

                <div class="question-card p-8">
                    <div id="question-content" class="mb-6">
                        <!-- 问题内容将通过JavaScript动态加载 -->
                    </div>
                    
                    <div class="flex justify-between">
                        <button id="prev-btn" 
                                class="px-6 py-2 bg-gray-300 text-gray-700 rounded-lg hover:bg-gray-400 transition duration-300 hidden">
                            上一题
                        </button>
                        <button id="next-btn" 
                                class="px-6 py-2 bg-gradient-to-r from-purple-600 to-blue-600 text-white rounded-lg hover:from-purple-700 hover:to-blue-700 transition duration-300">
                            下一题
                        </button>
                    </div>
                </div>
            </div>

            <!-- 结果页面 -->
            <div id="result-page" class="hidden">
                <div class="result-card p-8 fade-in">
                    <div class="text-center mb-6">
                        <h2 class="text-3xl font-bold text-gray-800 mb-4">
                            <i class="fas fa-clipboard-check mr-2"></i>
                            测试结果
                        </h2>
                        <div id="user-result-info" class="text-gray-600 mb-4"></div>
                    </div>

                    <div class="text-center mb-6">
                        <div class="text-6xl font-bold mb-2" id="score-display"></div>
                        <div class="text-xl" id="risk-level"></div>
                        <div class="text-gray-600 mt-2" id="score-description"></div>
                    </div>

                    <div class="border-t pt-6">
                        <h3 class="text-xl font-bold text-gray-800 mb-4">
                            <i class="fas fa-stethoscope mr-2"></i>
                            医学建议
                        </h3>
                        <div id="medical-advice" class="text-gray-700 space-y-3">
                            <!-- 医学建议将通过JavaScript动态加载 -->
                        </div>
                    </div>

                    <div class="mt-8 text-center">
                        <button onclick="restartTest()" 
                                class="px-8 py-3 bg-gradient-to-r from-purple-600 to-blue-600 text-white rounded-lg font-semibold hover:from-purple-700 hover:to-blue-700 transition duration-300">
                            重新测试
                        </button>
                    </div>
                </div>
            </div>
        </div>
    </main>

    <script>
        // 全局变量
        let currentQuestionIndex = 0;
        let userAnswers = new Array(35).fill(null);
        let userInfo = {};

        // 35道健康测试题（基于公开医学资料）
        const questions = [
            {
                id: 1,
                question: "您每周进行中等强度运动（如快走、游泳）的频率是？",
                type: "single",
                options: [
                    { text: "从不运动", score: 3 },
                    { text: "1-2次", score: 2 },
                    { text: "3-4次", score: 1 },
                    { text: "5次及以上", score: 0 }
                ]
            },
            {
                id: 2,
                question: "您的睡眠质量如何？",
                type: "single",
                options: [
                    { text: "经常失眠，每天睡眠不足6小时", score: 3 },
                    { text: "偶尔失眠，每天睡眠6-7小时", score: 2 },
                    { text: "睡眠一般，每天睡眠7-8小时", score: 1 },
                    { text: "睡眠良好，每天睡眠8小时以上", score: 0 }
                ]
            },
            {
                id: 3,
                question: "您是否经常感到疲劳或精力不足？",
                type: "single",
                options: [
                    { text: "经常，影响日常生活", score: 3 },
                    { text: "偶尔，但可忍受", score: 2 },
                    { text: "很少，基本正常", score: 1 },
                    { text: "从不，精力充沛", score: 0 }
                ]
            },
            {
                id: 4,
                question: "您的饮食习惯如何？（多选）",
                type: "multiple",
                options: [
                    { text: "经常吃快餐或外卖", score: 1 },
                    { text: "蔬菜水果摄入不足", score: 1 },
                    { text: "经常暴饮暴食", score: 1 },
                    { text: "饮食规律，营养均衡", score: -1 }
                ]
            },
            {
                id: 5,
                question: "您的体重指数（BMI）情况是？",
                type: "single",
                options: [
                    { text: "肥胖（BMI≥28）", score: 3 },
                    { text: "超重（24≤BMI<28）", score: 2 },
                    { text: "正常（18.5≤BMI<24）", score: 0 },
                    { text: "偏瘦（BMI<18.5）", score: 1 }
                ]
            },
            {
                id: 6,
                question: "您是否吸烟？",
                type: "single",
                options: [
                    { text: "每天吸烟", score: 3 },
                    { text: "偶尔吸烟", score: 2 },
                    { text: "已戒烟", score: 1 },
                    { text: "从不吸烟", score: 0 }
                ]
            },
            {
                id: 7,
                question: "您的饮酒习惯是？",
                type: "single",
                options: [
                    { text: "每天饮酒", score: 3 },
                    { text: "每周饮酒3-4次", score: 2 },
                    { text: "偶尔饮酒", score: 1 },
                    { text: "从不饮酒", score: 0 }
                ]
            },
            {
                id: 8,
                question: "您是否经常感到压力过大？",
                type: "single",
                options: [
                    { text: "经常，难以缓解", score: 3 },
                    { text: "偶尔，但可自我调节", score: 2 },
                    { text: "很少，基本无压力", score: 1 },
                    { text: "从不，心态良好", score: 0 }
                ]
            },
            {
                id: 9,
                question: "您的血压情况是？",
                type: "single",
                options: [
                    { text: "高血压（≥140/90）", score: 3 },
                    { text: "血压偏高（130-139/85-89）", score: 2 },
                    { text: "血压正常（<130/85）", score: 0 },
                    { text: "不清楚", score: 1 }
                ]
            },
            {
                id: 10,
                question: "您的血糖情况是？",
                type: "single",
                options: [
                    { text: "糖尿病", score: 3 },
                    { text: "血糖偏高（空腹6.1-7.0）", score: 2 },
                    { text: "血糖正常（空腹<6.1）", score: 0 },
                    { text: "不清楚", score: 1 }
                ]
            },
            {
                id: 11,
                question: "您的血脂情况是？",
                type: "single",
                options: [
                    { text: "高血脂", score: 3 },
                    { text: "血脂偏高", score: 2 },
                    { text: "血脂正常", score: 0 },
                    { text: "不清楚", score: 1 }
                ]
            },
            {
                id: 12,
                question: "您是否经常感到胸闷或心悸？",
                type: "single",
                options: [
                    { text: "经常", score: 3 },
                    { text: "偶尔", score: 2 },
                    { text: "很少", score: 1 },
                    { text: "从不", score: 0 }
                ]
            },
            {
                id: 13,
                question: "您的性功能状况如何？",
                type: "single",
                options: [
                    { text: "明显减退", score: 3 },
                    { text: "略有减退", score: 2 },
                    { text: "基本正常", score: 1 },
                    { text: "完全正常", score: 0 }
                ]
            },
            {
                id: 14,
                question: "您是否经常腰酸背痛？",
                type: "single",
                options: [
                    { text: "经常，影响生活", score: 3 },
                    { text: "偶尔，可忍受", score: 2 },
                    { text: "很少", score: 1 },
                    { text: "从不", score: 0 }
                ]
            },
            {
                id: 15,
                question: "您的排尿情况是？（多选）",
                type: "multiple",
                options: [
                    { text: "尿频", score: 1 },
                    { text: "尿急", score: 1 },
                    { text: "尿痛", score: 1 },
                    { text: "夜尿增多", score: 1 },
                    { text: "排尿正常", score: -1 }
                ]
            },
            {
                id: 16,
                question: "您是否经常头痛或头晕？",
                type: "single",
                options: [
                    { text: "经常", score: 3 },
                    { text: "偶尔", score: 2 },
                    { text: "很少", score: 1 },
                    { text: "从不", score: 0 }
                ]
            },
            {
                id: 17,
                question: "您的视力情况是？",
                type: "single",
                options: [
                    { text: "近视>600度", score: 2 },
                    { text: "近视300-600度", score: 1 },
                    { text: "近视<300度", score: 0 },
                    { text: "视力正常", score: 0 }
                ]
            },
            {
                id: 18,
                question: "您是否经常感到焦虑或抑郁？",
                type: "single",
                options: [
                    { text: "经常，影响生活", score: 3 },
                    { text: "偶尔，但可控制", score: 2 },
                    { text: "很少", score: 1 },
                    { text: "从不", score: 0 }
                ]
            },
            {
                id: 19,
                question: "您的家族病史包括？（多选）",
                type: "multiple",
                options: [
                    { text: "心脏病", score: 1 },
                    { text: "高血压", score: 1 },
                    { text: "糖尿病", score: 1 },
                    { text: "癌症", score: 1 },
                    { text: "无相关病史", score: -1 }
                ]
            },
            {
                id: 20,
                question: "您是否定期体检？",
                type: "single",
                options: [
                    { text: "从不体检", score: 3 },
                    { text: "偶尔体检（>2年一次）", score: 2 },
                    { text: "基本定期（1-2年一次）", score: 1 },
                    { text: "每年体检", score: 0 }
                ]
            },
            {
                id: 21,
                question: "您的口腔健康如何？",
                type: "single",
                options: [
                    { text: "经常牙痛或牙龈出血", score: 2 },
                    { text: "偶尔口腔问题", score: 1 },
                    { text: "口腔健康良好", score: 0 },
                    { text: "不清楚", score: 1 }
                ]
            },
            {
                id: 22,
                question: "您是否经常感冒？",
                type: "single",
                options: [
                    { text: "每月都感冒", score: 3 },
                    { text: "每季度感冒", score: 2 },
                    { text: "半年感冒一次", score: 1 },
                    { text: "很少感冒", score: 0 }
                ]
            },
            {
                id: 23,
                question: "您的消化系统如何？",
                type: "single",
                options: [
                    { text: "经常腹泻或便秘", score: 3 },
                    { text: "偶尔消化不良", score: 2 },
                    { text: "基本正常", score: 1 },
                    { text: "完全正常", score: 0 }
                ]
            },
            {
                id: 24,
                question: "您是否经常使用手机或电脑？",
                type: "single",
                options: [
                    { text: "每天>8小时", score: 2 },
                    { text: "每天5-8小时", score: 1 },
                    { text: "每天3-5小时", score: 1 },
                    { text: "每天<3小时", score: 0 }
                ]
            },
            {
                id: 25,
                question: "您的皮肤状况如何？",
                type: "single",
                options: [
                    { text: "经常皮肤问题", score: 2 },
                    { text: "偶尔皮肤问题", score: 1 },
                    { text: "皮肤健康", score: 0 },
                    { text: "不清楚", score: 1 }
                ]
            },
            {
                id: 26,
                question: "您是否经常感到关节疼痛？",
                type: "single",
                options: [
                    { text: "经常", score: 3 },
                    { text: "偶尔", score: 2 },
                    { text: "很少", score: 1 },
                    { text: "从不", score: 0 }
                ]
            },
            {
                id: 27,
                question: "您的听力状况如何？",
                type: "single",
                options: [
                    { text: "明显听力下降", score: 2 },
                    { text: "轻微听力下降", score: 1 },
                    { text: "听力正常", score: 0 },
                    { text: "不清楚", score: 1 }
                ]
            },
            {
                id: 28,
                question: "您是否经常熬夜？",
                type: "single",
                options: [
                    { text: "经常熬夜（>23点睡）", score: 3 },
                    { text: "偶尔熬夜", score: 2 },
                    { text: "很少熬夜", score: 1 },
                    { text: "从不熬夜", score: 0 }
                ]
            },
            {
                id: 29,
                question: "您的社交活动频率是？",
                type: "single",
                options: [
                    { text: "很少社交", score: 2 },
                    { text: "偶尔社交", score: 1 },
                    { text: "经常社交", score: 0 },
                    { text: "每天社交", score: 0 }
                ]
            },
            {
                id: 30,
                question: "您是否经常感到记忆力减退？",
                type: "single",
                options: [
                    { text: "经常", score: 3 },
                    { text: "偶尔", score: 2 },
                    { text: "很少", score: 1 },
                    { text: "从不", score: 0 }
                ]
            },
            {
                id: 31,
                question: "您的体重变化情况是？",
                type: "single",
                options: [
                    { text: "近一年增加>10kg", score: 3 },
                    { text: "近一年增加5-10kg", score: 2 },
                    { text: "近一年增加<5kg", score: 1 },
                    { text: "体重稳定", score: 0 }
                ]
            },
            {
                id: 32,
                question: "您是否经常感到口渴？",
                type: "single",
                options: [
                    { text: "经常", score: 2 },
                    { text: "偶尔", score: 1 },
                    { text: "很少", score: 0 },
                    { text: "从不", score: 0 }
                ]
            },
            {
                id: 33,
                question: "您的手部是否经常麻木？",
                type: "single",
                options: [
                    { text: "经常", score: 2 },
                    { text: "偶尔", score: 1 },
                    { text: "很少", score: 0 },
                    { text: "从不", score: 0 }
                ]
            },
            {
                id: 34,
                question: "您是否经常感到呼吸困难？",
                type: "single",
                options: [
                    { text: "经常", score: 3 },
                    { text: "偶尔", score: 2 },
                    { text: "很少", score: 1 },
                    { text: "从不", score: 0 }
                ]
            },
            {
                id: 35,
                question: "您是否经常感到食欲不振？",
                type: "single",
                options: [
                    { text: "经常", score: 3 },
                    { text: "偶尔", score: 2 },
                    { text: "很少", score: 1 },
                    { text: "从不", score: 0 }
                ]
            }
        ];

        // 表单验证
        document.getElementById('user-form').addEventListener('submit', function(e) {
            e.preventDefault();
            
            const name = document.getElementById('user-name').value.trim();
            const gender = document.getElementById('user-gender').value;
            const age = parseInt(document.getElementById('user-age').value);
            
            // 姓名验证（2-3个汉字）
            const nameRegex = /^[\u4e00-\u9fa5]{2,3}$/;
            if (!nameRegex.test(name)) {
                document.getElementById('name-error').textContent = '请输入2-3个汉字的姓名';
                document.getElementById('name-error').classList.remove('hidden');
                return;
            } else {
                document.getElementById('name-error').classList.add('hidden');
            }
            
            // 年龄验证
            if (age < 18 || age > 35) {
                document.getElementById('age-error').textContent = '年龄必须在18-35岁之间';
                document.getElementById('age-error').classList.remove('hidden');
                return;
            } else {
                document.getElementById('age-error').classList.add('hidden');
            }
            
            // 保存用户信息
            userInfo = { name, gender, age };
            
            // 切换到测试页面
            document.getElementById('welcome-page').classList.add('hidden');
            document.getElementById('test-page').classList.remove('hidden');
            
            // 显示用户信息
            document.getElementById('user-info-display').textContent = `${name} · ${age}岁`;
            
            // 加载第一题
            loadQuestion(0);
        });

        // 加载问题
        function loadQuestion(index) {
            const question = questions[index];
            const questionContent = document.getElementById('question-content');
            
            let html = `
                <h3 class="text-xl font-bold text-gray-800 mb-4">${question.id}. ${question.question}</h3>
                <div class="space-y-3">
            `;
            
            question.options.forEach((option, optIndex) => {
                const isSelected = userAnswers[index] === optIndex;
                const optionClass = isSelected ? 'option-item selected' : 'option-item';
                
                if (question.type === 'multiple') {
                    html += `
                        <div class="${optionClass} p-4 border border-gray-200 rounded-lg" 
                             onclick="toggleMultipleChoice(${index}, ${optIndex})">
                            <label class="flex items-center cursor-pointer">
                                <input type="checkbox" ${isSelected ? 'checked' : ''} 
                                       class="mr-3" onchange="return false;">
                                <span>${option.text}</span>
                            </label>
                        </div>
                    `;
                } else {
                    html += `
                        <div class="${optionClass} p-4 border border-gray-200 rounded-lg" 
                             onclick="selectAnswer(${index}, ${optIndex})">
                            <label class="flex items-center cursor-pointer">
                                <input type="radio" name="q${index}" ${isSelected ? 'checked' : ''} 
                                       class="mr-3" onchange="return false;">
                                <span>${option.text}</span>
                            </label>
                        </div>
                    `;
                }
            });
            
            html += '</div>';
            questionContent.innerHTML = html;
            
            // 更新进度
            document.getElementById('current-question').textContent = index + 1;
            document.getElementById('progress-bar').style.width = `${((index + 1) / 35) * 100}%`;
            
            // 更新按钮状态
            const prevBtn = document.getElementById('prev-btn');
            const nextBtn = document.getElementById('next-btn');
            
            if (index === 0) {
                prevBtn.classList.add('hidden');
            } else {
                prevBtn.classList.remove('hidden');
            }
            
            if (index === 34) {
                nextBtn.textContent = '完成测试';
            } else {
                nextBtn.textContent = '下一题';
            }
        }

        // 单选题选择
        function selectAnswer(questionIndex, optionIndex) {
            userAnswers[questionIndex] = optionIndex;
            loadQuestion(questionIndex); // 重新加载以更新UI
        }

        // 多选题选择
        function toggleMultipleChoice(questionIndex, optionIndex) {
            if (userAnswers[questionIndex] && Array.isArray(userAnswers[questionIndex])) {
                const index = userAnswers[questionIndex].indexOf(optionIndex);
                if (index > -1) {
                    userAnswers[questionIndex].splice(index, 1);
                } else {
                    userAnswers[questionIndex].push(optionIndex);
                }
            } else {
                userAnswers[questionIndex] = [optionIndex];
            }
            loadQuestion(questionIndex);
        }

        // 上一题
        document.getElementById('prev-btn').addEventListener('click', function() {
            if (currentQuestionIndex > 0) {
                currentQuestionIndex--;
                loadQuestion(currentQuestionIndex);
            }
        });

        // 下一题/完成
        document.getElementById('next-btn').addEventListener('click', function() {
            if (currentQuestionIndex < 34) {
                currentQuestionIndex++;
                loadQuestion(currentQuestionIndex);
            } else {
                showResults();
            }
        });

        // 计算得分并显示结果
        function showResults() {
            let totalScore = 0;
            
            userAnswers.forEach((answer, index) => {
                const question = questions[index];
                if (question.type === 'multiple') {
                    if (Array.isArray(answer)) {
                        answer.forEach(optIndex => {
                            totalScore += question.options[optIndex].score;
                        });
                    }
                } else if (answer !== null) {
                    totalScore += question.options[answer].score;
                }
            });
            
            // 显示结果页面
            document.getElementById('test-page').classList.add('hidden');
            document.getElementById('result-page').classList.remove('hidden');
            
            // 显示用户信息
            document.getElementById('user-result-info').textContent = 
                `${userInfo.name} · ${userInfo.age}岁 · 测试完成`;
            
            // 显示得分
            document.getElementById('score-display').textContent = `${totalScore}分`;
            
            // 确定风险等级和建议
            let riskLevel, riskClass, description, advice;
            
            if (totalScore <= 15) {
                riskLevel = '低风险';
                riskClass = 'risk-low';
                description = '您的健康状况良好，请继续保持良好的生活习惯。';
                advice = [
                    '继续保持现有的健康生活方式',
                    '建议每年进行一次全面体检',
                    '保持规律的运动习惯',
                    '注意均衡饮食，多吃蔬菜水果',
                    '保证充足睡眠，每天7-8小时'
                ];
            } else if (totalScore <= 30) {
                riskLevel = '中等风险';
                riskClass = 'risk-medium';
                description = '您的健康存在一些风险因素，需要适当调整生活方式。';
                advice = [
                    '建议6个月内进行一次全面体检',
                    '增加运动频率，每周至少3-4次',
                    '减少烟酒摄入，最好戒烟戒酒',
                    '改善饮食结构，减少高油高盐食物',
                    '学会压力管理，保持良好心态',
                    '保证充足睡眠，避免熬夜'
                ];
            } else {
                riskLevel = '高风险';
                riskClass = 'risk-high';
                description = '您的健康风险较高，建议尽快就医检查。';
                advice = [
                    '建议1-3个月内进行全面体检',
                    '立即就医咨询专业医生意见',
                    '严格控制饮食，制定健康计划',
                    '立即开始规律运动，循序渐进',
                    '戒烟戒酒，避免不良嗜好',
                    '学习压力管理技巧，必要时寻求心理帮助',
                    '建立健康档案，定期监测身体指标',
                    '考虑咨询营养师制定个性化饮食方案'
                ];
            }
            
            document.getElementById('risk-level').textContent = riskLevel;
            document.getElementById('risk-level').className = `text-xl font-bold ${riskClass}`;
            document.getElementById('score-description').textContent = description;
            
            // 显示医学建议
            const adviceHtml = advice.map(item => 
                `<div class="flex items-start">
                    <i class="fas fa-check-circle text-green-500 mr-2 mt-1"></i>
                    <span>${item}</span>
                </div>`
            ).join('');
            document.getElementById('medical-advice').innerHTML = adviceHtml;
        }

        // 重新测试
        function restartTest() {
            currentQuestionIndex = 0;
            userAnswers = new Array(35).fill(null);
            userInfo = {};
            
            document.getElementById('result-page').classList.add('hidden');
            document.getElementById('welcome-page').classList.remove('hidden');
            document.getElementById('user-form').reset();
        }
    </script>
</body>
</html>
